\(\int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx\) [696]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F]
   Fricas [F]
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 23, antiderivative size = 155 \[ \int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx=-\frac {a b (2-m) (d \cos (e+f x))^m}{f (1-m) m}+\frac {\left (b^2-a^2 (1-m)\right ) \cos (e+f x) (d \cos (e+f x))^m \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1+m}{2},\frac {3+m}{2},\cos ^2(e+f x)\right ) \sin (e+f x)}{f (1-m) (1+m) \sqrt {\sin ^2(e+f x)}}+\frac {b (d \cos (e+f x))^m (a+b \tan (e+f x))}{f (1-m)} \]

[Out]

-a*b*(2-m)*(d*cos(f*x+e))^m/f/(1-m)/m+(b^2-a^2*(1-m))*cos(f*x+e)*(d*cos(f*x+e))^m*hypergeom([1/2, 1/2+1/2*m],[
3/2+1/2*m],cos(f*x+e)^2)*sin(f*x+e)/f/(-m^2+1)/(sin(f*x+e)^2)^(1/2)+b*(d*cos(f*x+e))^m*(a+b*tan(f*x+e))/f/(1-m
)

Rubi [A] (verified)

Time = 0.28 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3596, 3589, 3567, 3857, 2722} \[ \int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx=\frac {\left (b^2-a^2 (1-m)\right ) \sin (e+f x) \cos (e+f x) (d \cos (e+f x))^m \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {m+1}{2},\frac {m+3}{2},\cos ^2(e+f x)\right )}{f (1-m) (m+1) \sqrt {\sin ^2(e+f x)}}-\frac {a b (2-m) (d \cos (e+f x))^m}{f (1-m) m}+\frac {b (a+b \tan (e+f x)) (d \cos (e+f x))^m}{f (1-m)} \]

[In]

Int[(d*Cos[e + f*x])^m*(a + b*Tan[e + f*x])^2,x]

[Out]

-((a*b*(2 - m)*(d*Cos[e + f*x])^m)/(f*(1 - m)*m)) + ((b^2 - a^2*(1 - m))*Cos[e + f*x]*(d*Cos[e + f*x])^m*Hyper
geometric2F1[1/2, (1 + m)/2, (3 + m)/2, Cos[e + f*x]^2]*Sin[e + f*x])/(f*(1 - m)*(1 + m)*Sqrt[Sin[e + f*x]^2])
 + (b*(d*Cos[e + f*x])^m*(a + b*Tan[e + f*x]))/(f*(1 - m))

Rule 2722

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*((b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1
)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n
}, x] &&  !IntegerQ[2*n]

Rule 3567

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*((d*Sec[
e + f*x])^m/(f*m)), x] + Dist[a, Int[(d*Sec[e + f*x])^m, x], x] /; FreeQ[{a, b, d, e, f, m}, x] && (IntegerQ[2
*m] || NeQ[a^2 + b^2, 0])

Rule 3589

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[b*(d*Sec
[e + f*x])^m*((a + b*Tan[e + f*x])/(f*(m + 1))), x] + Dist[1/(m + 1), Int[(d*Sec[e + f*x])^m*(a^2*(m + 1) - b^
2 + a*b*(m + 2)*Tan[e + f*x]), x], x] /; FreeQ[{a, b, d, e, f, m}, x] && NeQ[a^2 + b^2, 0] && NeQ[m, -1]

Rule 3596

Int[(cos[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[(d*Co
s[e + f*x])^m*(d*Sec[e + f*x])^m, Int[(a + b*Tan[e + f*x])^n/(d*Sec[e + f*x])^m, x], x] /; FreeQ[{a, b, d, e,
f, m, n}, x] &&  !IntegerQ[m]

Rule 3857

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x])^(n - 1)*((Sin[c + d*x]/b)^(n - 1)
*Int[1/(Sin[c + d*x]/b)^n, x]), x] /; FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]

Rubi steps \begin{align*} \text {integral}& = \left ((d \cos (e+f x))^m (d \sec (e+f x))^m\right ) \int (d \sec (e+f x))^{-m} (a+b \tan (e+f x))^2 \, dx \\ & = \frac {b (d \cos (e+f x))^m (a+b \tan (e+f x))}{f (1-m)}+\frac {\left ((d \cos (e+f x))^m (d \sec (e+f x))^m\right ) \int (d \sec (e+f x))^{-m} \left (-b^2+a^2 (1-m)+a b (2-m) \tan (e+f x)\right ) \, dx}{1-m} \\ & = -\frac {a b (2-m) (d \cos (e+f x))^m}{f (1-m) m}+\frac {b (d \cos (e+f x))^m (a+b \tan (e+f x))}{f (1-m)}+\frac {\left (\left (-b^2+a^2 (1-m)\right ) (d \cos (e+f x))^m (d \sec (e+f x))^m\right ) \int (d \sec (e+f x))^{-m} \, dx}{1-m} \\ & = -\frac {a b (2-m) (d \cos (e+f x))^m}{f (1-m) m}+\frac {b (d \cos (e+f x))^m (a+b \tan (e+f x))}{f (1-m)}+\frac {\left (\left (-b^2+a^2 (1-m)\right ) \left (\frac {\cos (e+f x)}{d}\right )^{-m} (d \cos (e+f x))^m\right ) \int \left (\frac {\cos (e+f x)}{d}\right )^m \, dx}{1-m} \\ & = -\frac {a b (2-m) (d \cos (e+f x))^m}{f (1-m) m}+\frac {\left (b^2-a^2 (1-m)\right ) \cos (e+f x) (d \cos (e+f x))^m \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1+m}{2},\frac {3+m}{2},\cos ^2(e+f x)\right ) \sin (e+f x)}{f (1-m) (1+m) \sqrt {\sin ^2(e+f x)}}+\frac {b (d \cos (e+f x))^m (a+b \tan (e+f x))}{f (1-m)} \\ \end{align*}

Mathematica [A] (verified)

Time = 5.48 (sec) , antiderivative size = 140, normalized size of antiderivative = 0.90 \[ \int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx=\frac {(d \cos (e+f x))^m \left (2 a b \left (-1+\sec ^2(e+f x)^{m/2}\right )+b^2 m \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {m}{2},\frac {3}{2},-\tan ^2(e+f x)\right ) \sec ^2(e+f x)^{m/2} \tan (e+f x)+\left (a^2-b^2\right ) m \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2+m}{2},\frac {3}{2},-\tan ^2(e+f x)\right ) \sec ^2(e+f x)^{m/2} \tan (e+f x)\right )}{f m} \]

[In]

Integrate[(d*Cos[e + f*x])^m*(a + b*Tan[e + f*x])^2,x]

[Out]

((d*Cos[e + f*x])^m*(2*a*b*(-1 + (Sec[e + f*x]^2)^(m/2)) + b^2*m*Hypergeometric2F1[1/2, m/2, 3/2, -Tan[e + f*x
]^2]*(Sec[e + f*x]^2)^(m/2)*Tan[e + f*x] + (a^2 - b^2)*m*Hypergeometric2F1[1/2, (2 + m)/2, 3/2, -Tan[e + f*x]^
2]*(Sec[e + f*x]^2)^(m/2)*Tan[e + f*x]))/(f*m)

Maple [F]

\[\int \left (d \cos \left (f x +e \right )\right )^{m} \left (a +b \tan \left (f x +e \right )\right )^{2}d x\]

[In]

int((d*cos(f*x+e))^m*(a+b*tan(f*x+e))^2,x)

[Out]

int((d*cos(f*x+e))^m*(a+b*tan(f*x+e))^2,x)

Fricas [F]

\[ \int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cos \left (f x + e\right )\right )^{m} \,d x } \]

[In]

integrate((d*cos(f*x+e))^m*(a+b*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

integral((b^2*tan(f*x + e)^2 + 2*a*b*tan(f*x + e) + a^2)*(d*cos(f*x + e))^m, x)

Sympy [F]

\[ \int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx=\int \left (d \cos {\left (e + f x \right )}\right )^{m} \left (a + b \tan {\left (e + f x \right )}\right )^{2}\, dx \]

[In]

integrate((d*cos(f*x+e))**m*(a+b*tan(f*x+e))**2,x)

[Out]

Integral((d*cos(e + f*x))**m*(a + b*tan(e + f*x))**2, x)

Maxima [F]

\[ \int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cos \left (f x + e\right )\right )^{m} \,d x } \]

[In]

integrate((d*cos(f*x+e))^m*(a+b*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

integrate((b*tan(f*x + e) + a)^2*(d*cos(f*x + e))^m, x)

Giac [F]

\[ \int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{2} \left (d \cos \left (f x + e\right )\right )^{m} \,d x } \]

[In]

integrate((d*cos(f*x+e))^m*(a+b*tan(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((b*tan(f*x + e) + a)^2*(d*cos(f*x + e))^m, x)

Mupad [F(-1)]

Timed out. \[ \int (d \cos (e+f x))^m (a+b \tan (e+f x))^2 \, dx=\int {\left (d\,\cos \left (e+f\,x\right )\right )}^m\,{\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}^2 \,d x \]

[In]

int((d*cos(e + f*x))^m*(a + b*tan(e + f*x))^2,x)

[Out]

int((d*cos(e + f*x))^m*(a + b*tan(e + f*x))^2, x)